package com.boyon.system.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.boyon.common.request.RequestEntity;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 
 * ClassName: Menu <br/>
 * Function: 系统菜单及按钮实体类. <br/>
 * date: 2018年3月13日 上午10:59:41 <br/>
 * 
 * @author sunshulin
 * @version
 * @since JDK 1.8
 */
@Entity
@Table(name = "sys_menu", catalog = "boyon_system")
@Data
@EqualsAndHashCode(callSuper = false)
public class Menu extends RequestEntity implements java.io.Serializable {

	/**
	 * serialVersionUID:
	 * 
	 * @since JDK 1.8
	 */
	private static final long serialVersionUID = -8489029426899640116L;
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "menu_id", unique = true, nullable = false)
	private Long menuId;
	@Column(name = "parent_id")
	private Long parentId;
	@Column(name = "menu_code", length = 18)
	private String menuCode;
	@Column(name = "menu_name", length = 32)
	private String menuName;
	@Column(name = "menu_type")
	private Integer menuType;
	@Column(name = "container_type")
	private Integer containerType;
	@Column(name = "container", length = 128)
	private String container;
	@Column(name = "seqencing")
	private Integer seqencing;
	@Column(name = "icon", length = 128)
	private String icon;
	@Column(name = "status")
	private Integer status;
	@Column(name = "is_system")
	private Integer isSystem;
	@Column(name = "param", length = 1024)
	private String param;
	@Transient
	private List<Menu> children = new ArrayList<>();

	/**
	 * 
	 * addChildren:添加子节点. <br/>
	 * 
	 * @author sunshulin
	 * @param node
	 * @since JDK 1.8
	 */
	public void addChildren(Menu node) {
		children.add(node);
	}
}